home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-03 | 1.8 KB | 56 lines | [TEXT/OIUB] |
- `timescale 1 ns / 100 ps
- /* Linear Feedback Shift Register
- * verilog module "VCOUNT"
- * Generated by Macintosh application 'LFSR' 5/17/93 1:32 PM
- * company: Apple Computer
- * project: Display Controller
- * designer: Elmer Fudd
- * prototypes:
- VCOUNT(clk, NextLine, preset, Frame);
- VCOUNT(.clk(CLOCK), .NextLine(CE), .preset(PRESET), .Frame(TC));
- *
- * The counter reaches terminal count after 480 positive edge clocks.
- * 'Frame' is asserted high at the end of count.
- * count is preset synchronously by an active high on 'preset'.
- * The counter is free running. It presets itself on every terminal count.
- * The counting is suspended when 'NextLine' is asserted low.
- * The counter uses AND (or NAND) gates on the output of the shift register to detect for terminal count of all 'ones'.
- * The main counter consist of 9 registers with 2 taps feedback to the input.
- */
- module VCOUNT (clk, NextLine, preset, Frame);
- input clk;
- input NextLine;
- input preset;
- output Frame;
- reg [8:0] D;
- reg [8:0] Q;
-
- assign Frame = &Q;
-
- always @(Q or preset or Frame or NextLine)
- begin
- casex ({preset, Frame, NextLine}) // synopsys parallel_case full_case
- 'b??0:
- begin
- D = Q; // suspend counting
- end
- 'b1?1, // preset to value
- 'b?11: // retrigger presets from TC
- begin
- D = 'h16F; // preset to seed
- end
- 'b001: // normal counting
- begin
- D[8:1] = Q[7:0];
- D[0] = Q[8] ^ Q[3];
- end
- endcase
- end // always
-
- // Shift register description
- always @(posedge clk)
- begin
- Q = D; // make into D register
- end
- endmodule // VCOUNT
-